#include "stdafx.h"
#include ".\tgafile.h"

TgaFile::TgaFile(void)
{
}

TgaFile::~TgaFile(void)
{
}

void TgaFile::Write(const char szFileName)
{
	//BYTE btTGAHeader[12] = { 0,0,2,0,0,0,0,0,0,0,0,0 };
	//BYTE btHeader[6];
	//int  uBytesPerPixel = 0;
	//int  uImageSize = 0;
	//BYTE uTemp;
	//FILE *pWrite = NULL;
	//char filename[128];
	////GLubyte *imagedata;
	//GLuint i;

	//btHeader[0] = (GLubyte)(uWidth % 256);
	//btHeader[1] = (GLubyte)(uWidth / 256);
	//btHeader[2] = (GLubyte)(uHeight % 256);
	//btHeader[3] = (GLubyte)(uHeight / 256);
	//btHeader[4] = (GLubyte)uBits;
	//btHeader[5] = 8;

	//uBytesPerPixel = uBits / 8;
	//uImageSize = uWidth * uHeight * uBytesPerPixel;
	////imagedata = malloc(uImageSize);

	//memcpy(imagedata, pixels, sizeof(GLubyte) * uImageSize);

	//sprintf(filename, "dumpdata\\tex\\texture%d.tga", unTexID);

	//pWrite = fopen(filename, "wb");
	//if(pWrite == NULL)
	//	return;

	//drawMessage(5, 100, "Writing texture: %d", unTexID);

	//fwrite(btTGAHeader, 12, sizeof(GLubyte), pWrite);
	//fwrite(btHeader, 6, sizeof(GLubyte), pWrite);

	//for(i = 0; i < uImageSize; i += uBytesPerPixel)
	//{
	//	uTemp=imagedata[i];
	//	imagedata[i] = imagedata[i + 2];
	//	imagedata[i + 2] = uTemp;
	//}

	//fwrite(imagedata, uImageSize, sizeof(GLubyte), pWrite);

	////free(imagedata);
	//fclose(pWrite);

	//count++;
}